package com.schedualnew.mq.dto.esb.xray.pacssource;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.schedualnew.mq.dto.esb.AccessControl;
import com.schedualnew.mq.dto.esb.MessageHeader;
import lombok.Data;

import java.util.List;

/**
 * @author ljy aka ryan
 * @date 2023/3/20$ 17:40$
 * @description TODO
 */
@Data
@JacksonXmlRootElement(localName = "ESBEntry")
public class SourceSendESBEntry {
    @JacksonXmlProperty(localName = "AccessControl")
    public AccessControl accessControl;

    @JacksonXmlProperty(localName = "MessageHeader")
    public MessageHeader messageHeader;

    @JacksonXmlProperty(localName = "MsgInfo")
    private XRayQueryMsgInfo msgInfo;

    @JacksonXmlProperty(localName = "RequestOption")
    private RequestOption requestOption;

    @JacksonXmlProperty(localName = "GroupInfo")
    private GroupInfo groupInfo;

    @Data
    public static class XRayQueryMsgInfo {
        @JacksonXmlProperty
        @JacksonXmlElementWrapper(useWrapping = false)
        private List<QueryItem> query;

        @JacksonXmlProperty(localName = "flag", isAttribute = true)
        private String flag;
    }


    @Data
    public static class QueryItem {
        @JacksonXmlProperty(localName = "item", isAttribute = true)
        private String item;
        @JacksonXmlProperty(localName = "compy", isAttribute = true)
        private String compy;
        @JacksonXmlProperty(localName = "value", isAttribute = true)
        private String value;
        @JacksonXmlProperty(localName = "splice", isAttribute = true)
        private String splice;
    }


    @Data
    public static class RequestOption {
        @JacksonXmlProperty(localName = "triggerData")
        private String triggerData;
        @JacksonXmlProperty(localName = "dataAmount")
        private String dataAmount;
    }

    @Data
    public static class GroupInfo {
        @JacksonXmlProperty(localName = "flag", isAttribute = true)
        private String flag;

        @JacksonXmlProperty(localName = "AS")
        private GroupInfoAs as;
    }

    @Data
    public static class GroupInfoAs {
        @JacksonXmlProperty(localName = "ID", isAttribute = true)
        private String id;

        @JacksonXmlProperty(localName = "linkField", isAttribute = true)
        private String linkField;
    }

}


